home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 7: Sunsite / Linux Cubed Series 7 - Sunsite Vol 1.iso / system / serial / callback.001 / callback~ / callback / lib / process / modemrespawn.c < prev    next >
C/C++ Source or Header  |  1996-07-28  |  614b  |  29 lines

  1.  
  2. #include "process.p"
  3. #include "../../configure.h"
  4.  
  5. void modem_respawn()
  6. {
  7.     FILE
  8.         *pslist;
  9.     char    
  10.         buf[500];
  11.     int
  12.     kills;
  13.  
  14.     if (!(pslist = popen(PSCMD, "r")))
  15.         error("Can't get processes list");
  16.                
  17.     kills = 0;                                  /* no process killed yet */
  18.  
  19.     log(log_max, "Looking for %s-processes", getmodembase());
  20.  
  21.     while (fgets(buf, 499, pslist))             /* walk all processes */
  22.         kills += modemkill(buf);                /* kill if a modem process */
  23.  
  24.     if (!kills)
  25.     log(log_on, "No modem process(es) killed");
  26.  
  27.     pclose(pslist);
  28. }
  29.